﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.BizTalk.ExplorerOM;
using DBLOG.BizTalk.BizTalkExplorerServices.Core;

namespace DBLOG.BizTalk.BizTalkExplorerServices.Entities
{
    public class BTSReceiveLocation : BTSPortBase
    {
        private ReceiveLocation _receiveLocation { get; set; }

        public BTSReceiveLocation()
        {
            
        }

        internal BTSReceiveLocation(ReceiveLocation receiveLocation)
        {
            this._receiveLocation = receiveLocation;

            this.PopulateSimpleProperties();
        }

        private void PopulateSimpleProperties()
        {
            this.Name = _receiveLocation.Name;

            this.Status = _receiveLocation.Enable ? Core.Status.Started : Core.Status.Stopped;

            this.TransportAddress = _receiveLocation.Address;

            this.TransportProtocol = _receiveLocation.TransportType.Name;

            this.ApplicationName = _receiveLocation.ReceivePort.Application.Name;
        }
    }
}
